﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using XMK.Utils;
using XMK.Framework.Model.Cond;
using XMK.Framework.Model;

namespace XMK.Tadong.WebService
{
    /// <summary>
    /// WSService 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://data.tadong.com/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务，请取消对下行的注释。
    // [System.Web.Script.Services.ScriptService]
    public class WSService : System.Web.Services.WebService, IService
    {

        [WebMethod]
        public string callService(string commCondJson)
        {
            DateTime startTime = DateTime.Now;
            string callTimeTime = DateHelper.ConvertString(startTime, DateHelper.FORMAT_yyyy_MM_dd_HH_mm_ss_fff);
            LogHelper.WriteLog(LogType.Debug, "[开始:" + callTimeTime + "][入参][condJson:]" + commCondJson);
            // 对条件进行解析
            CommonDataCond cond = JsonHelper.FromJsonMs<CommonDataCond>(commCondJson);
            CommonDataInfo info = XMK.Framework.SpManager.Execute(cond);
            string str = JsonHelper.ToJson(info);
            LogHelper.WriteLog(LogType.Debug, "[结束耗时:" + DateHelper.GetTimeSpanString(startTime) + "][返回][returnJson:]" + str);
            return str;
        }
    }
}
